//
//  RXXKVideoPlayer.h
//  RXXKVideo
//
//  Created by 星仔 on 2019/3/21.
//  Copyright © 2019年 rxx. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, RXXKVideoPlayerStatus) {
    RXXKVideoPlayerStatusUnload,      // 未加载
    RXXKVideoPlayerStatusPrepared,    // 准备播放
    RXXKVideoPlayerStatusLoading,     // 加载中
    RXXKVideoPlayerStatusPlaying,     // 播放中
    RXXKVideoPlayerStatusPaused,      // 暂停
    RXXKVideoPlayerStatusEnded,       // 播放完成
    RXXKVideoPlayerStatusError        // 错误
};

@class RXXKVideoPlayer;

@protocol RXXKVideoPlayerDelegate <NSObject>

- (void)player:(RXXKVideoPlayer *)player statusChanged:(RXXKVideoPlayerStatus)status;

- (void)player:(RXXKVideoPlayer *)player currentTime:(float)currentTime totalTime:(float)totalTime progress:(float)progress;

@end

@interface RXXKVideoPlayer : NSObject

@property (nonatomic, weak) id<RXXKVideoPlayerDelegate>     delegate;

@property (nonatomic, assign) RXXKVideoPlayerStatus         status;

@property (nonatomic, assign) BOOL                          isPlaying;


/**
 根据指定url在指定视图上播放视频
 
 @param playView 播放视图
 @param url 播放地址
 */
- (void)playVideoWithView:(UIView *)playView url:(NSString *)url;

/**
 停止播放并移除播放视图
 */
- (void)removeVideo;

/**
 暂停播放
 */
- (void)pausePlay;

/**
 恢复播放
 */
- (void)resumePlay;

/**
 重新播放
 */
- (void)resetPlay;

@end

NS_ASSUME_NONNULL_END
